// item selection
$('dd>div').click(function () {
  $(this).toggleClass('selected');
  var obj = $(this).next().children(":checkbox");
  if(obj.prop('checked')){
	  obj.prop('checked', false);
  } else {
	  obj.prop('checked', true);
  }
});

// all item selection
$('.select').click(function () {
  if ($('li.selected').length == 0) {
    $('li').addClass('selected');
    $('.select').addClass('selected');
  }
  else {
    $('li').removeClass('selected');
    $('.select').removeClass('selected');
  }
  counter();
});

// number of selected items
function counter() {
  if ($('li.selected').length > 0)
    $('.send').addClass('selected');
  else
    $('.send').removeClass('selected');
  $('.send').attr('data-counter',$('li.selected').length);
}
